import React from "react";

export default class StateTry extends React.Component{
    state = {
        isNight:false
    }

    render(){
        return <div>
            <h2>至尊宝,我是{this.state.isNight ? '紫霞仙子':'青霞仙子'}</h2>
            <button onClick={this.click.bind(this)}>点我换人</button>
        </div>
    }
    click(){
        this.setState({isNight:!this.state.isNight})
    }
}